import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import router from './router'
import store from './store'
import { Auth } from '@/common'

/* 引入vue-material */
import VueMaterial from 'vue-material'
import 'vue-material/dist/vue-material.min.css'
import 'vue-material/dist/theme/default.css'

/* 引入element-ui */
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import '@/assets/css/index.css'
/* 自定义的组件 */
import Components from "@/components";
Object.keys(Components).forEach(compName => {
  Vue.component(compName, Components[compName]);
});

Vue.use(VueMaterial);
Vue.use(ElementUI);
Vue.config.productionTip = false

// example
Auth.setToken('Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXJyZW50X2xvZ2luX2RhdGUiOiIxNjA1NzgwMzc2NzI1IiwidXNlcl9uYW1lIjoiYWRtaW5AZWRvb3ZvLmNvbSIsInNjb3BlIjpbInVzZXIiXSwiaWQiOiIxIiwicmVtZW1iZXJfbWUiOiJmYWxzZSIsImV4cCI6MTYwNTc5NDc4MSwiYXV0aG9yaXRpZXMiOlsiQVVUSF9TVFVERU5UUyIsIkFVVEhfUVVJWl9CQU5LIiwiQVVUSF9QQVJFTlRTIiwiQVVUSF9QUk9EVUNUUyIsIkFVVEhfQ0xBU1MiLCJBVVRIX1VTRVJTIiwiQVVUSF9PUkRFUlMiLCJBVVRIX0NVUlJJQ1VMQSIsIkFVVEhfVEVBQ0hFUlMiLCJBVVRIX01PTklUT1IiLCJBVVRIX1NUQUZGIl0sImp0aSI6IjMyODBlN2FmLTRmNGQtNGEyMS1hZGNhLTQxNDllZThlOTJkZSIsImNsaWVudF9pZCI6ImNsaWVudGlkIn0.lv3qjIagjCFf29IVfq64w1dQY1CdMmWIHcnzgJYPkggPIlJCT2Vm9li-onJROwHSuhCfKZPnH-dalHo7a43Bug_pCqWJBqG2GCPkkQI-YjZi-Cm4vNex5kgsp5Oc0dhZgj2JjbbvhJnPVnXX-XEsBr5vF0GIQicle_tTQLU4m8TNedLRmynM282gxs11U8Y5BCmqRzJ8OAHzGx12i3xfS0Wg_NXPSvIpAYXZojjW9oQ45HqIqYVH2Ufw6ah2058GAI9eC2bjK59krFBKY8bdR5FIaRTgJtdbOoZ47-9cYyrtiUd6Ua4rW4xrJxDY4xRjKmfmLO5XEoqetCF-pEHbpg')

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
